 /**
 * @file tkl_zcl_group.h
 * @brief Common process - group
 * @version 1.0.0
 * @date 2021-05-13
 *
 * @copyright Copyright 2021-2022 Tuya Inc. All Rights Reserved.
 *
 */

#ifndef __TKL_ZCL_GROUP_H__
#define __TKL_ZCL_GROUP_H__


#ifdef __cplusplus
    extern "C" {
#endif

#include "tuya_cloud_types.h"



typedef VOID_T (*TKL_ADD_GROUP_CB)(UINT8_T ep_id, UINT16_T group_id);
typedef VOID_T (*TKL_VIEW_GROUP_CB)(UINT8_T ep_id, UINT16_T group_id);
typedef VOID_T (*TKL_REMOVE_GROUP_CB)(UINT8_T ep_id, UINT16_T group_id);
typedef VOID_T (*TKL_REMOVE_ALL_GROUP_CB)(UINT8_T ep_id);

/*
 *  zigbee group callback collection
 */
typedef struct {
    TKL_ADD_GROUP_CB add_group_cb;          ///< add group callback
    TKL_VIEW_GROUP_CB view_group_cb;        ///< view group callback
    TKL_REMOVE_GROUP_CB remove_group_cb;    ///< remove group callback
    TKL_REMOVE_ALL_GROUP_CB remove_all_group_cb;    ///< remove group callback
} TKL_GROUP_CB_T;


/**
 * @brief group callback register
 *
 * @param[in]   group_cb: group callback collection
 * @return  0: success  Other: fail
 */
OPERATE_RET tkl_zg_group_cb_register(TKL_GROUP_CB_T *group_cb);

/**
 * @brief find group on endpoint
 *
 * @param[in]   ep_id:    endpoint
 * @param[in]   group_id: group id
 * @return  TRUE/ FALSE
 */
BOOL_T tkl_zg_find_group(UINT8_T ep_id, UINT16_T group_id);

/**
 * @brief add group at location endpoint
 * 
 * @param[in]   ep_id:    endpoint
 * @param[in]   group_id: group id
 * @return  TRUE/ FALSE
 */
BOOL_T tkl_zg_add_group(UINT8_T ep_id, UINT16_T group_id);

/**
 * @brief remove group at location endpoint
 *
 * @param[in]   ep_id:    endpoint
 * @param[in]   group_id: group id
 * @return  TRUE/ FALSE
 */
BOOL_T tkl_zg_remove_group(UINT8_T ep_id, UINT16_T group_id);

/**
 * @brief clear all group
 *
 * @param[in]   none
 * @return  none
 */
VOID_T tkl_zg_clear_all_group(VOID_T);


#ifdef __cplusplus
}
#endif

#endif

